#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e7 + 5;

int n, m;
int np[N], primes[N], tot;
int phi[N];
ll sum[N];
int cnt[N];
void init(int n) {
  np[1] = 1;
  rep(i, 2, n) {
    cnt[i] = cnt[i - 1];
    if (!np[i]) {
      primes[++tot] = i;
      phi[i] = i - 1;
      cnt[i]++;
    }
    rep(j, 1, tot) {
      ll k = 1ll * primes[j] * i;
      if (k > n) break;
      np[k] = 1;
      if (i % primes[j] == 0) {
        phi[k] = phi[i] * primes[j];
        break;
      } else
        phi[k] = phi[i] * (primes[j] - 1);
    }
  }
  sum[1] = 1;
  rep(i, 2, n) sum[i] = sum[i - 1] + 2 * phi[i];
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  init(n);
  ll ans = 0;
  for (int l = 1, r; l <= n; l = r + 1) {
    int x = n / l;
    r = min(n, n / x);
    ans += 1ll * (cnt[r] - cnt[l - 1]) * sum[x];
  }
  cout << ans;
  return 0;
}